import Vue from 'vue';
import util from '@/libs/util';
Vue.directive(
    'hasC', {
        inserted: function (el, binding) {
            if (binding.value) {
                if (util.storage.get('is_super') != 1) {
                    let menus = util.storage.get('menus');
                    let power = menus.action;
                    if (typeof binding.value === 'string') {
                        let flag = power.find((ee) => ee.flag === binding.value);
                        if (!flag) el.style.display = 'none';
                    } else {
                        let flag = power.find(
                            (ee) =>
                            ee.flag === binding.value.flag &&
                            ee.marking === binding.value.name
                        );
                        if (!flag) el.style.display = 'none';
                    }
                }
            }
        }
    }
);